package com.jz.action;

import java.util.List;

import com.jz.manage.ModelManage;
import com.jz.model.Model;
import com.jz.model.Test;
import com.opensymphony.xwork2.ActionSupport;

public class ModelAction extends ActionSupport {
	
	private ModelManage modelManage;
	
	private List<Model> modelList;
	
	private Model model;
	
	private int number;
	private int kind;
	private String label;
	private String description;
	
	
	public int getNumber() {
		return number;
	}

	public void setNumber(int number) {
		this.number = number;
	}

	public int getKind() {
		return kind;
	}

	public void setKind(int kind) {
		this.kind = kind;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public void setModelManage(ModelManage modelManage){
		this.modelManage = modelManage;
	}
	
	public List<Model> getModelList() {
		return modelList;
	}


	public void setModelList(List<Model> modelList) {
		this.modelList = modelList;
	}


	public Model getModel() {
		return model;
	}


	public void setModel(Model model) {
		this.model = model;
	}


	public String modelList(){
		modelList = modelManage.getModels();
		for (Model model : modelList) {
			List<Test> list = model.getTestList();
			System.out.println(list.size());
		}
		return SUCCESS;
	}
	
	public String modelSave(){
		model = new Model();
		model.setNumber(number);
		model.setKind(kind);
		model.setLabel(label);
		model.setDescription(description);
		modelManage.insertModel(model);
		return SUCCESS;
	}

}
